<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@page import="java.sql.*"%>
<%@page import="java.io.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'Question.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript">
			function countLines()
	{
		
		var area = document.getElementById("texta")
        // trim trailing return char if exists
  		var text = area.value.replace(/\s+$/g,"")
 		alert(text);
 		
  		var split = text.split("\n")
  		alert(split);
  		alert(split.length);
  		
  	}

	function connection()
	{
		var value= document.getElementById("texta").value
		
		//var t=value.replace(
		alert(value);
	}
	function quit()
	{
		alert("your application is closed");
	}
	</script>
  </head>
  
  <body>
    <%String name=request.getParameter("title");
    //out.println(name);
    try
    {
   		    Class.forName("com.mysql.jdbc.Driver");
			String url="jdbc:mysql://localhost:3306/websurvey";
			Connection con=DriverManager.getConnection(url, "root", "mysql");
			//out.println("connection established");
			 Statement st = con.createStatement();  
				  
	}
	catch(Exception e)
	{
			out.print(e);
	}
	%>
   <form action="http://localhost:8080/OnlineWeb/StoreQuestion" method="get">
	<h3><font color="red">Survey Title:</font>
	
	<input type="text" name="tablename"value="<%=name %>" disabled="disabled"/></h3>
	
   	<h3><font color="#99CC00">Question</font></h3>
   	<div style="background-color:Silver">
   	&nbsp<h4>Question Text</h4>
   	
    &nbsp<textarea rows="4" cols="60"name="question"></textarea>
    
   	&nbsp<h4>Question Type</h4>
   	
   	&nbsp<select name="type">
   	<option>Yes/No</option> 
   	<option>Multiple Choice</option> 
   	<option>DropDownList</option> 
   	<option>MultiLine Text</option> 
   	</select>
   
   	<br/>
   		&nbsp
   	</div>
 <h3><font color="#99CC00">Answers Options</font></h3>
 
   <div style="background-color:Silver" >
   	&nbsp<h4>Answer choice:Enter each choice on separate line</h4>
   	
   	&nbsp<textarea rows="4" cols="60" name="option"></textarea>
   	
   		<br/>   	&nbsp
   		<!-- <button onclick="alert(countLines())">count</button>-->
 		<input type="submit" value="Save"/>
   		
   		<input type="submit" value="Quit" onclick="quit();"/>
   </div>
  
   </form>
 
  </body>
</html>
